package com.example.battle.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.battle.common.HttpClientUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Data
@Slf4j
@RestController
public class QuestionController {
    @RequestMapping(value = "/getQuestion", produces = "application/json; charset=utf-8")
    public JSONObject getQuestion() {
        String requestUrl = "http://203.195.239.100:10086/tiku/api/v1/queryProblems";
        String json = "{\n" +
                "  \"poolId\":\"4468c74d-759e-4d78-8c43-e1c5405f193b\",\n" +
                "  \"token\":\"06e599f3-78db-4c71-b4fa-2b496beab1f6\",\n" +
                "  \"querry\":{\n" +
                "      \"operator\":\"contains\",\n" +
                "      \"argument1\":\"tags\",\n" +
                "      \"argument2\":[\"一年级\"]\n" +
                "  }\n" +
                "}";
        JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doPostJson(requestUrl, json));
        return jsonObject;
    }
}